package menu;

import java.util.ArrayList;
import java.util.List;

/**
 * build menu with array list
 * @author yuanml
 */
public class ArrayListMenu implements Menu {
    List<MenuItem> items = new ArrayList<>();
    public ArrayListMenu() {
        addItem("arrayListItem1","arrayListItem1",true, 21.1);
        addItem("arrayListItem2","arrayListItem2",true, 2.31);
        addItem("arrayListItem3","arrayListItem3",false, 25.1);
        addItem("arrayListItem4","arrayListItem4",true, 15.1);
        addItem("arrayListItem5","arrayListItem5",true, 20.1);
        addItem("arrayListItem6","arrayListItem6",false, 29.1);
    }

    public void addItem(String name, String description, boolean vegetarian, double price) {
        MenuItem menuItem = new MenuItem();
        menuItem.setDescription(description);
        menuItem.setName(name);
        menuItem.setPrice(price);
        menuItem.setVegetarian(vegetarian);
        items.add(menuItem);
    }

    public List<MenuItem> getMenuItems() {
        return items;
    }

    @Override
    public Iterator createIterator() {
        return new ArrayListMenuIterator(items);
    }
}
